# Sample Plugin: Filter
#

package MT::Plugin::MyPlugin04;

use strict;
use MT;
use MT::Template::Context;
use vars qw($VERSION);
$VERSION = '0.1';

@MT::Plugin::MyPlugin04::ISA = qw(MT::Plugin);

my $plugin = new MT::Plugin::MyPlugin04({
    name => '<MT_TRANS phrase=\'Sample Plugin: Text Filter\'>',
    version => $VERSION,
    description => '<MT_TRANS phrase=\'_PLUGIN_DESCRIPTION\'>',
    author_name => '<MT_TRANS phrase=\'_PLUGIN_AUTHOR\'>',
    author_link => 'http://www.example.com/about/',
    doc_link => 'http://www.example.com/docs/',
    l10n_class => 'MyPlugin04::L10N',
});

MT->add_plugin($plugin);

MT::Template::Context->add_global_filter(link_mt => \&link_mt);

sub link_mt {
    my($text, $arg, $ctx) = @_;

    if($arg == '1') {
        $text =~ s!Movable Type!<a href="http://www.sixapart.jp/movabletype/">Movable Type</a>!gs;
    }
    return $text;
}

1;
